﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Inventory.Database
{
    public class UnitOfWork:IUnitOfWork<InventoryContext>
    {
        private readonly InventoryContext _context;

        public UnitOfWork()
        {
            _context = new InventoryContext();
        }

        public UnitOfWork(InventoryContext context)
        {
            _context = context;
        }

        public int Save()
        {
            return _context.SaveChanges();
        }

        public InventoryContext Context
        {
            get { return _context; }
        }

        public void Dispose()
        {
            _context.Dispose();
        }
    }
}
